home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
- This document provides information on how to create a QuickBASIC library
- of user routines.
-
- One of the features that I found particularly appealing about
- Microsoft's QuickBasic was that the documentation indicated that you
- could create libraries of user routines. Unfortunately, when I
- attempted to work with libraries I found that I had all sorts of
- problems. Some of this was probably due to my own ineptitude, and some
- due to Microsoft's documentation. Assuming that other programmers
- attempting to use QuickBASIC libraries for the first time might
- encounter the same problems, I created this document.
-
- Please note that there is a glossary of terms that I will be using on
- the last page.
-
- There are a few assumptions that I make ...
-
- 1. The ultimate goal is to have free-standing programs created using
- the /O compile option with the BCOM20 library, and at the same
- time to be able to use those same routines during development (ie.
- when using the QuickBASIC editor/compile to memory feature).
-
- 2. I assume that you have read the QuickBASIC reference manual on
- user libraries. If you feel as frustrated as I did ... well, at
- least I won't feel that I'm the only one who had problems.
- Hopefully, you should be at the level where you understand that
- when I refer to USERLIB as the library, you realize that this
- could represent any name of your choice.
-
- 3. You have used, or at least understand, the "Separate Compilation"
- method as outlined in Microsoft's manual.
-
- 4. Your modules are subroutines written using the SUB...END SUB form,
- thus allowing you to pass parameters.
-
- A couple of general points ...
-
- 1. QuickBASIC does NOT load USERLIB.EXE automatically as stated in
- the manual .. at least I haven't been able to get it to work, and
- I am using the LIB= function documented in the QuickBASIC manual.
- But then again, you don't actually believe everything you read in
- a manual, do you?. I suggest that you invoke the library manually
- using the /L option as stated in the QuickBASIC manual; at least
- THAT works.
-
- 2. If you have the LIB program from the Microsoft Macro Assembler,
- you'll find it useful for maintaining your libraries. However, it
- certainly is not required.
-
- It might be useful at this point to look at the diagram at the bottom of
- this document, and to refer to it while reading the following
- descriptions. In the examples below, the extensions, and sometimes the
- resulting file names, can be provided by the Microsoft programs by
- default. However, for clarity, I have specified all extensions and
- filenames.
-
-
-
-
-
-
-
-
-
-
-
- Your modules to be accessed from within QuickBASIC during development
- need to reside in USERLIB.EXE. To place them in that library ...
-
- 1. Compile your routines WITHOUT using the /O option to use the
- BRUN20.LIB. This can be done either from within QB or using the
- command line method.
-
- Example : QB module.bas ;
-
- 2. Use BUILDLIB to place the resulting .OBJ files into the
- USERLIB.EXE library (note the extension .EXE). Since BUILDLIB
- creates the library from scratch each time, using the MAKE.EXE
- utility supplied with the Microsoft Macro Assembler can help
- automate this process (if you haven't seen it, MAKE.EXE can
- rebuild the library any time one of the original routines is
- changed).
-
- Example : BUILDLIB module1.obj+module2.obj,userlib.exe ;
-
- 3. Start QB using your library name with the /L option, and the
- routines will be available to you.
-
- Example : QB /L userlib.exe
-
- Modules that are to be used with your free-standing program are compiled
- differently, and can optionally be stored in a true library.
-
- 1. Compile your routines WITH the /O option to use the BCOM20.LIB.
- This can be done either from within QB or using the command line
- method.
-
- Example : QB module.bas /O ;
-
- 2. If you have it available, you can use the LIB.EXE program supplied
- with the MS Macro Assembler to place the resulting .OBJ files into
- a true USERLIB.LIB library file (note the extension .LIB).
- LIB.EXE can use the MAKE.EXE utility to help automate maintenance
- of this library.
-
- Example : LIB myprogs.lib +module.obj ;
-
- Note that if you had previously placed MODULE.OBJ in the library,
- the command would be ...
-
- Example : LIB myprogs.lib -+module.obj ;
-
- 3. If you don't have LIB.EXE, you can use the DOS COPY command to
- place a number of
-
- By now you realize that you are going to have two different types of
- .OBJ files. Those you create from your subroutine compiled WITHOUT the
- /O option to be used in USERLIB.EXE, and those compiled WITH the /O
- option (optionally kept in USERLIB.LIB).
-
- To avoid as much confusion as possible, I rename the .OBJ files created
- for use with USERLIB.EXE as .RUN files since they required the run-time
-
-
-
-
-
-
-
-
-
-
- library. The only inconvenience is that I have to specify the extension
- when using BUILDLIB.
-
- Example : QB module1.bas ;
- REN module1.obj module1.run
- BUILDLIB module1.run+module2.run,userlib.exe
-
- When linking your free-standing modules, you will need to either specify
- the individual .OBJ files, or, if you used LIB.EXE, the name of the
- library you created.
-
- Example : LINK
-
- Object Modules [.OBJ] : main.obj+module1.obj
- Run File [MAIN.EXE] :
- List File [NUL.MAP] :
- Libraries [.LIB] :
-
- Example : LINK
-
- Object Modules [.OBJ] : main.obj
- Run File [MAIN.EXE] :
- List File [NUL.MAP] :
- Libraries [.LIB] : userlib
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ********************** +--------------------+
- * PROGRAMS * | FILES |
- ********************** +--------------------+
-
-
-
- +------------+
- | MODULE.BAS |
- +------------+
- / \
- V V
- ********************** **********************
- * QUICKBASIC * * QUICKBASIC *
- * Compile WITHOUT /O * * Compile using /O *
- ********************** **********************
- | |
- V V
- +--------------------+ +--------------------+
- | MODULE.OBJ | | MODULE.OBJ |
- +--------------------+ +--------------------+
- | / .
- V / .
- ********************** / .
- * BUILDLIB * / This path is an alternate
- ********************** / depending on whether or not
- | + you own the MS Macro Assembler
- V | .
- +--------------------+ | .
- | USERLIB.EXE | | V
- | for use w/ QBASIC | | **********************
- +--------------------+ | * LIB *
- | **********************
- | .
- | .
- | V
- +--------------------+ | +--------------------+
- | MAIN.BAS | | | USERLIB.LIB |
- +--------------------+ | | for use with LINK |
- | | +--------------------+
- V + .
- ********************** \ .
- * QUICKBASIC * \ .
- * Compile using /O * \ .
- ********************** \ .
- | \ .
- V V V
- +-------------------+ **********************
- | MAIN.OBJ |---------------> * LINK *
- +-------------------+ **********************
- |
- V
- +--------------------+
- | MAIN.EXE |
- +--------------------+
-
-
-
-
-
-
-
-
-
-
-
-
- GLOSSARY OF TERMS
-
- .OBJ file - A compiled subroutine or main program prior to linking or
- installing in a library. THERE ARE TWO DIFFERENT TYPES OF OBJ
- FILES. One type has been compiled WITH the /O option, the other
- without.
-
- BCOM20.LIB - The Microsoft library supplied with QuickBASIC that
- provides the routines need by free-standing programs.
-
- BRUN20.LIB - The Microsoft library supplied with QuickBASIC that is
- used during the development cycle (editing, compiling to memory,
- etc). This library is also used if you compile your program but
- do not make it free-standing.
-
- BUILDLIB.EXE - A support program from Microsoft that allows .OBJ files
- to be placed into a library file for use with QuickBASIC during
- development (editing, compiling to memory, etc).
-
- Free-standing module/program - A program or subroutine that has been
- compiled by QuickBASIC using the /O option so that it does not
- require the BRUN20 library.
-
- LIB.EXE - A support program from Microsoft that allows .OBJ files to
- be placed into a library file that can be used with the LINK
- program.
-
- USERLIB.EXE - A file containing a collection of subroutines. These
- routines are available within QuickBASIC during development
- (editing, compiling to memory, etc).
-
- USERLIB.LIB - A file containing a collection of subroutines. These
- routines are available to be linked to your separately compiled
- main programs.
-
- ------------------------------------------------------------------------
-
- If you found this to be interest, have any comments or suggestions, or
- tried to follow this but found it too confusing, drop me a note. In
- particular, please let me know if you have any corrections I need to
- make!
-
- It would be nice to know if someone actually reads this.
-
- Robert Potter
- 76266,2233
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-